<template lang="jade">
div#app
  div.return-bar(@click="back()")
    i.iconfont &#xe668;
    {{item.abstract1.name}}
  div.detail-page 
    
    ul.productlist.mini_top
      li
        h2 摘标中
        a(v-bind:href="getlink(item.name_no, item.borrow_nid)")

          div.first.info
            div.cover
              img(src="../../assets/images/index/car.jpg")
            div.item.big
              h3 {{item.name}}
              还款方式:{{item.abstract1.borrow_style}}
            div.item.small.tcenter
              circle-css(color="#ff6565", textcolor="#ff6565", width=52, :pv="25" ,  font-size=15, bold=6,  text-bg-color='#ffffff')

            div.item.small.tcenter
              span.tag 车贷标
          div.second.info
            div.item
              借款金额
              span.red
                b {{item.abstract1.account}}
                万
            div.item
              剩余可投
              span
                b {{item.abstract1.pick}}
                元
            div.item.small
              借款期限
              span
                b {{item.abstract1.borrow_day}}
                个月

   

    ul.productdetail
      li
        i
          img(src="../../assets/images/invest/mini-icon-1.png")
        span 约定收益率
        span.fl {{item.abstract1.borrow_apr}}%

      li
        i
          img(src="../../assets/images/invest/mini-icon-2.png")
        span 已投人数
        span.fl 9人

      li
        i
          img(src="../../assets/images/invest/mini-icon-3.png")
        span 最低起投
        span.fl 100元

      li
        i
          img(src="../../assets/images/invest/mini-icon-4.png")
        span 募资时间
        span.fl (暂时没有)截止2017年1月20日 24:00

      li
        i
          img(src="../../assets/images/invest/mini-icon-5.png")
        span 保障方式
        span.fl (暂时没有)车辆抵押, 第三方机构代偿

    ul.cbox.hl.producthl
      li
        a(v-link="{ path: '/invest/group-sub/1?groupId='+groupId }")
          i
            img(src="../../assets/images/invest/detail-hl-icon1.png")
          span 借款信息
      li(v-link="{ path: '/invest/guarantee/'+groupId }")
        a
          i
            img(src="../../assets/images/invest/detail-hl-icon2.png")
          span 还款保障
      li
        a(v-link="{ path: '/invest/group-sub/3?groupId='+groupId }")
          i
            img(src="../../assets/images/invest/detail-hl-icon3.png")
          span 投资记录
      li
        a(v-link="{ path: '/invest/group-sub/4?groupId='+groupId }")
          i
            img(src="../../assets/images/invest/detail-hl-icon4.png")
          span 还款计划


    section.form
      form#form_tender(action="http://api.uximoney.com/index.php?s=/Home/HXBank/tender.html",method="post",v-on:submit.prevent="onSubmit")
        div.postForm
          input.money(name="money",v-model="money",placeholder="数字要为1万的倍数，最低50万元",autocomplete="off")
          input(type="hidden",name="groupId",v-model="groupId")
          span.rmb 元
          ul.cbox
            li.balance
              可用余额￥
              b 1800{{banlance}}
              元
            li.btn
              input.goPay(type="submit",value="立即投标")
        


  
</template>

<script>
import '../../assets/sass/invest/invest.scss'
import {Api_Group_Detail} from '../../config/api'
import DialogPage from '../../components/common/dialog'

export default{
	data () {
		return{
			groupId:'',
			item:'',
		    showDialog: false,
		    deposit:'',
		    total_money:'',
		    typeClass:"noshow",
		    msg:'<div class="dialog"><div class="content"><span class="icon"></span><div class="title">恭喜您摘标成功</div><div class="subtitle"><i class="left"></i>理财金额<i class="right"></i></div><div class="total"> <span>¥</span><b>300</b><span>万元</span></div><div class="despoit">已支付定金10万元</div><div class="info"><div class="item"><b>约定收益率</b><strong>12</strong><span>万元</span></div><div class="item"><b>借款期限</b><strong>1</strong><span>个月</span></div></div><div class="extra"><span><i class="iconfont"></i><em>评估值:600万元</em></span><span><i class="iconfont"></i><em>抵押率:50%</em></span></div></div></div>'
		}
	},

	components:{
		dialog: DialogPage
	},

	methods:{
		show(){
			this.$children[0].show = true
			//this.dialog.template = "123"
			//this.$children[0].msg = true
			//console.log(this.template)
		},
		hide(){
			this.$children[0].show = false;
		},
		fetch:function(next){
			var that = this;
			this.$http({ url:Api_Group_Detail+'/name_no/'+this.groupId, method:'POST' }).then(function(rs){
				console.log(rs.data.data);
				that.item = rs.data.data;
				that.total_money = that.item.abstract1.account;

				next()
			})
		},
		book(){
			var that = this;
			if(that.deposit==""){
				alert("请输入投资金额!");
				return false;
			}else{

				if(isNaN(that.deposit)){
				   alert("你输入的不是数字");
				   return false;
				}

				console.log(that.deposit);
				
				if( that.deposit < 500000){
				   alert("摘金不小于50万");
				   return false;
				}

				if( that.deposit % 10000!=0){
				   alert("输入的数字要为1万的倍数!");
				   return false;
				}

			}

			this.$router.go('/group-sub/5?groupId='+this.groupId+'&deposit='+that.deposit);
		},

		back(){
			this.$route.router.go('/')
		}
	},
	route:{
	    activate ( transition ) {
	    	this.groupId = transition.to.params.groupId
			//this.dialog.template = '<div class="dialog"><div class="content"><span class="icon"></span><div class="title">恭喜您摘标成功</div><div class="subtitle"><i class="left"></i>理财金额<i class="right"></i></div><div class="total"> <span>¥</span><b>300</b><span>万元</span></div><div class="despoit">已支付定金10万元</div><div class="info"><div class="item"><b>约定收益率</b><strong>12</strong><span>万元</span></div><div class="item"><b>借款期限</b><strong>1</strong><span>个月</span></div></div><div class="extra"><span><i class="iconfont"></i><em>评估值:600万元</em></span><span><i class="iconfont"></i><em>抵押率:50%</em></span></div></div></div>'
			this.fetch(function(){
				transition.next();
			});
	    }
	}
}
</script>
